﻿using Jay.Sc2.Bof.Lib.State;

namespace Jay.Sc2.Bof.Lib.Action.Zerg
{
	public class ActionProduceOverseer : ActionProduceZerg
	{
		public static ActionProduceOverseer Instance = new ActionProduceOverseer();
		private ActionProduceOverseer() : base(17, 50, 100, 0) { }
		public override void Execute(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			base.Execute(bo);
			state.Overlord--;
			bo.AddAction(state.Time + BuildTime, new ActionGeneric("ActionSpawnOverseer", (ActionGeneric.ActionExecuteDelegate)delegate(IBuildOrder ibo)
			{
				ZergState ibostate = ibo.State as ZergState;
				state.Overseer++;
			}));
		}
		public override bool HaveTechnology(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			return state.Lair.Count > 0;
		}
		public override bool IsInvalid(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			return base.IsInvalid(bo) || state.Lair.Total == 0 || state.Overlord + state.Overlord_Building == 0;
		}
		public override int AvailableProducer(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			return state.Overlord;
		}
		private IAction[,] m_Requirements;
		public override IAction[,] Requirements
		{
			get
			{
				if (m_Requirements == null)
					m_Requirements = new IAction[,] { { ActionProduceLair.Instance } };
				return m_Requirements;
			}
		}
		private IAction[,] m_Inputs;
		public override IAction[,] Inputs
		{
			get
			{
				if (m_Inputs == null)
					m_Inputs = new IAction[,] { { ActionProduceOverlord.Instance } };
				return m_Inputs;
			}
		}
	}
}
